package top.dingwen.io.treasure.websocket.autoconfigure;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import top.dingwen.io.treasure.websocket.constant.WebSocketConstant;

/**
 * Websocket场景属性配置类
 *
 * @author dingwen
 * @since 2023/3/5 09:59
 */
@ConfigurationProperties(prefix = "dingwen.treasure.websocket")
@Getter
@Setter
public class WebSocketProperties {
    /**
     * 是否开启默认API,默认关闭 </br>
     * <ul>
     *     <li> true: 开启 </li>
     *     <li> false: 关闭 </li>
     * </ul>
     */
    private String defaultApiEnabled;

    /**
     * 是否开启默认关闭 </br>
     * <ul>
     *     <li> true: 开启 </li>
     *     <li> false: 关闭 </li>
     * </ul>
     */
    private String enabled;

    /**
     * 是否开启认证默认关闭 </br>
     * <ul>
     *     <li> true: 开启 </li>
     *     <li> false: 关闭 </li>
     * </ul>
     */
    private String auth;

    /**
     * 路径
     */
    private String path = WebSocketConstant.DEFAULT_WS;

    /**
     * 设置访问源地址
     */
    private String allowedOrigins = "*";

    /**
     * 是否开启心跳检测,默认关闭 </br>
     * <ul>
     *     <li> true: 开启 </li>
     *     <li> false: 关闭 </li>
     * </ul>
     */
    private String heartbeatEnabled;

    /**
     * 心跳超时时间（毫秒默认60秒)
     */
    private Long heartbeatTimeout = 600000L;


    /**
     * 最大文本消息缓冲区大小(kb)
     */
    private Integer maxTextMessageBufferSize = 1024;

    /**
     * 最大二进制消息缓冲区大小(kb)
     */
    private Integer maxBinaryMessageBufferSize = 1024;
}
